package sample.algo.sistr.algosample.algos.avl;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import sample.algo.sistr.algosample.R;
import sample.algo.sistr.algosample.algos.Algo;

public class Algo00 extends Algo {
    // No real algorythm here, just some test to check AVL implementation

    public Algo00(Context context) {
        super("AVL test", context);
    }

    @Override
    public View GetDisplay() {
        ViewGroup root = (ViewGroup)((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.algo_avl_00, null);

        TreeView tv = (TreeView)root.findViewById(R.id.tree_view);

        Node<Integer> treeRoot = new Node<Integer>(11, true);

        treeRoot = treeRoot.Add(9);
        treeRoot = treeRoot.Add(7);
        treeRoot = treeRoot.Add(15);
        treeRoot = treeRoot.Add(16);

        tv.SetTree(treeRoot);

        return root;
    }
}
